import React, { Component } from 'react'
import { Card, Tabs } from 'antd'

import '../../assets/css/Iogin.css'

import MobileForm from './MobileForm'
import PasswdForm from './PasswdForm'
class Index extends Component {
  constructor(props) {
    super(props)
    const jwt = sessionStorage.getItem('jwt')
    if (jwt) {
      this.props.history.push('/dashboard')
    }
  }

  render() {
    const { TabPane } = Tabs
    return (
      <div id="container">
        <Card id="loginCard">
          <Tabs defaultActiveKey="1" centered tabBarGutter={100}>
            <TabPane tab="密码登录" key="1">
              <PasswdForm />
            </TabPane>
            <TabPane tab="短信登录" key="2">
              <MobileForm />
            </TabPane>
          </Tabs>
        </Card>
      </div>
    )
  }
}

export default Index
